flag=False
f = -1
s = 1
i = 1
while not flag:
    t = 1 / (2 * i + 1)
    if t*4 < 0.0001:
        flag = True
    s = s + t*f
    f = -f
    i += 1
print('π精确到万分之一的结果：{:.4f}'.format(s*4))